package com.work.service.impl;

import com.work.bean.User;
import com.work.dao.UserDao;
import com.work.dao.impl.UserDaoImpl;
import com.work.service.UserService;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();

    public boolean registUser(User user) {
       int result = userDao.saveUser(user);
       return (result > -1);
    }

    public User login(User user) {
        return userDao.queryUserByUserNameAndPassWord(user.getUname(),user.getUpass());
    }

    public boolean existsUsername(String uname) {
            return (userDao.queryUserByUsername(uname) !=null);
    }
}
